import pygame
import os


# 获取当前项目的路径
projectPath=os.path.abspath('..')


# 子弹的类
class Bullet(pygame.sprite.Sprite):
    def __init__(self, position):
        self.image = pygame.image.load(projectPath + "/resources/images/bullet1.png").convert_alpha()
        self.rect=self.image.get_rect()
        self.rect.left = position[0]
        self.rect.top = position[1]
        self.speed=15
        self.active = True
        self.mask=pygame.mask.from_surface(self.image)

    def move(self):
        self.rect.top -= self.speed
        if self.rect.top < 0:
            self.active = False


# 超级子弹的类
class SuperBullet(pygame.sprite.Sprite):
    def __init__(self, position):
        self.image = pygame.image.load(projectPath + "/resources/images/bullet2.png").convert_alpha()
        self.rect=self.image.get_rect()
        self.rect.left = position[0]
        self.rect.top = position[1]
        self.speed=20
        self.active = True
        self.mask=pygame.mask.from_surface(self.image)

    def move(self):
        self.rect.top -= self.speed
        if self.rect.top  < 0:
            self.active=False
